package fr.fbhelp.parsing
{
	/**
	 * Representation of XML Package:
	 * <package
	 * id="en_US_Flex_4.0_UsingFlashBuilder"
	 * label="Using Adobe Flash Builder 4"
	 * path="en_US/Flex/4.0/UsingFlashBuilder"
	 * contextSensitivity="yes"
	 * downloadContent="client.Flex_4.0_UsingFlashBuilder_en-us.zip"
	 * downloadContentDefault="yes"
	 * />
	 */
	public class HelpPackage
	{
		private var _label:String;
		private var _path:String;
		private var _toc:Toc;
		
		public function parseFromXML(pkgXml:XML):void
		{
			label = pkgXml.@label;
			path = pkgXml.@path;
			
			Output.append("\tPackage '" + label + "', path: " + path);
		}
		
		public function setPackageContents(pkg:HelpPackage, $toc:Toc):void
		{
			if ($toc != null)
			{
				pkg.toc = $toc;
				Output.append("\tSet package contents: " + pkg.label);
			}
		}
		
		public function parseTocFromContents():void
		{
			toc.parseFromContents();
		}
		
		public function HelpPackage()
		{
		}
		
		public function get path():String
		{
			return _path;
		}

		public function set path(value:String):void
		{
			_path = value;
		}

		public function get label():String
		{
			return _label;
		}

		public function set label(value:String):void
		{
			_label = value;
		}

		public function get toc():Toc
		{
			return _toc;
		}

		public function set toc(value:Toc):void
		{
			_toc = value;
		}

	}
}